/*
 * config.h
 *
 *  Created on: 2013. 5. 1.
 *      Author: ozarwork@gmail.com
 *        Note: load configuration file, ./data/config.ini
 *
 *       Usage: Config config;
 *				config.setFont();
 */

#ifndef CONFIG_H
#define CONFIG_H

#include "def.h"

class Config
{
public:
	Config(std::tstring fileName);
	virtual ~Config();

	// get,set properties
	std::tstring getFontFace()
	{	return _fontFace;	}
	void setFontFace(std::tstring f)
	{	_fontFace = f;		}
	int getFontWidth()
	{	return _fontWidth;	}
	void setFontWidth(int w)
	{	_fontWidth = w;		}
	int getFontHeight()
	{	return _fontHeight;	}
	void setFontHeight(int h)
	{	_fontHeight = h;	}

	// functions
	void setFont();

private:
    static const int	_BUFFER = 255;	// configuration buffer size
    LPTSTR				_buf;			// configuration buffer
    /* [FONT] - parsing string	*/
    LPCTSTR				_cFONT				= _T("FONT");
    LPCTSTR				_cFONT_face			= _T("face");
    LPCTSTR				_cFONT_width		= _T("width");
    LPCTSTR				_cFONT_height		= _T("height");

    /* [FONT] - default values	*/
	LPCTSTR				_cFONT_faceDef		= _T("FixedSys");
	const int			_cFONT_widthDef		= 8;
	const int			_cFONT_heightDef	= 16;

	std::tstring		_fileName;		// Configuration File

	int		        	_fontWidth;		// Font Width
	int	        		_fontHeight;	// Font Height
	std::tstring		_fontFace;		// Font Face

	// internal functions
	void setFontFace();
	void setFontWidth();
	void setFontHeight();
};

#endif /* CONFIG_H */
